In the RDF data model, the data is modeled as labeled and directed graphs, represented as a set of triples. The nodes in the graph are used to represent two parts of a given triple, and the third part is represented by a directed link that describes the relationship between the nodes. In the context of an RDF expression, the two nodes are referred to as “subject” and “object” and the link describing the relationship is referred to as “predicate”.
The subject and object of a particular RDF expression may be resources that are identified by Uniform Resource Identifiers (URIs). A predicate is also represented by a URI. A URI includes a prefix that may refer to an electronic location on the Internet, or may refer to a namespace within a database system. For example, standard prefixes “rdf:”, “rdfs:” and “xsd:” are generally defined as follows:
Prefix “rdf:”; namespace URI: http://www.w3.org/1999/02/22-rdf-syntax-ns#
Prefix “rdfs:”; namespace URI: http://www.w3.org/2000/01/rdf-schema#
Prefix “xsd:”; namespace URI: http://www.w3.org/2001/XMLSchema#
Prefixes, such as “ogc:”, and “edb:”, may be defined within a database system to refer to a personal or other namespace in the system.
Instead of a resource, the object of a particular RDF expression may be a literal of some well-defined data type, e.g., “xsd:string”, “xsd:integer”, “xsd:float”, “xsd:double”, “xsd:boolean”, “xsd:dateTime”, “xsd:decimal”, etc. Many literals are found within the “xsd:” namespace, however, literals may be defined within any number of namespaces. An RDF database system generally includes mappings between literals and the corresponding data types as supported by the host database management system. For example, when an RDF database system is implemented as a SQL application, the “xsd:string” data type in RDF may be mapped to a “VARCHAR2” data type in the database management system.
The properties that describe a resource are broadly classified into object-type properties and data-type properties. Object-type properties describe a subject resource, indicated by a URI in the subject position of a triple, using another resource in the object position of the triple, also identified by a URI. On the other hand, a data-type property describes a subject resource using a literal in the object position of the triple. In the following example, Triple 1 is an object-type property and Triple 2 is a data-type property.
Triple 1: <http://www.geonames.org/states/NewHampshire><http://www.geonames.org/pred/hasCity><http://www.geonames.org/cities/Nashua>Triple 2: <http://www.geonames.org/cities/Nashua><http://www.geonames.org/pred/hasName>“Nashua”{circumflex over ( )}{circumflex over ( )}xsd:string
SPARQL, which stands for SPARQL Protocol and RDF Query Language, is an example of an RDF query language. SPARQL is based on triple graph pattern matching and was standardized by the W3C in January 2008. In a SPARQL triple graph pattern, any or all of the subject, object, and predicate may be a variable. (See “SPARQL Query Language for RDF,” W3C Recommendation 15 Jan. 2008, found at the time of writing this specification in the folder TR/rdf-sparql-query/ at the domain www.w3.org, the entirety of which is incorporated by reference herein.) The W3C recommendation for SPARQL indicates that “[a] basic graph pattern matches a subgraph of the RDF data when RDF terms from that subgraph may be substituted for the variables and the result is RDF graph equivalent to the subgraph.” (See id.)
A basic SPARQL query may include a SELECT clause, a WHERE clause, and one or more query variables. A SPARQL query may also include one or more PREFIX bindings, a FILTER clause, a FROM clause, a FROM NAMED clause, a GRAPH clause, an ORDER BY clause, etc. An example SPARQL Query 1 is shown below:
Query 1:SELECT?xWHERE {<http://www.geonames.org/cities/Nashua><http://www.geonames.org/pred/hasName> ?x}Query 1 selects all RDF triples with objects that have the relation “<http://www.geonames.org/pred/hasName>” to the subject resource “<http://www.geonames.org/cities/Nashua>”. Referring to Triples 1 and 2 above, the result returned from Query 1 would be: “Nashua”^^xsd:string.
Existing systems hardwire both mappings between the logical and physical representations of RDF data, and mappings between SPARQL query-constructs and corresponding constructs in the underlying host system. Such hardwired mappings make extending RDF database systems expensive and error prone in light of new requirements from emerging application domains. Open-source database systems allow end-user modifications to the core components. However, this approach often leads to one-off specializations that are not reusable and hard to maintain.
The approaches described in this section are approaches that could be pursued, but not necessarily approaches that have been previously conceived or pursued. Therefore, unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section.